#/bin/sh

# arch 安装配置
# read -p '输入网址：' url

#wpa_supplicant -i wlan0  -c  w.conf &
# swapon /dev/sdaX

# 01. network
echo " >>>>>> use eth0"
read i
if [[ $i == 'y' ]]; then
	ifconfig eth0 up
	dhcpcd eth0
	ping -c 3 www.baidu.com
	ip addr
fi

# 01. pacman update
echo " >>>>>> edit /etc/pacman.d/mirrorlist use china.163 ? y/n" 
read i
if [[ $i == 'y' ]]; then
	vi /etc/pacman.d/mirrorlist
fi

#mv /etc/profile.d/locale.sh /etc/profile.d/locale.sh.bak
#pacman -Sf filesystem --force

echo " >>>>>> nameserver 8.8.8.8" >> /etc/resolv.conf
vi /etc/resolv.conf

echo " >>>>>> select update 1.n - 2.y"
pacman -Syuf

echo " >>>>>> new pacman 4.0"
#mv /etc/pacman.conf /etc/pacman.conf.bak
#mv /etc/pacman.conf.pacnew /etc/pacman.conf

echo "edit pacman.conf  SigLevel TrustAll and add

[multilib]
Include = /etc/pacman.d/mirrorlist 

#aur
[archlinuxfr]
Server = http://repo.archlinux.fr/\$arch

"

echo "
[multilib]
Include = /etc/pacman.d/mirrorlist 

#aur
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/\$arch
" >> /etc/pacman.conf
vi /etc/pacman.conf

# 使用最接近的源
# rankmirrors -n 6 mirrorlist.backup > mirrorlist
#rm /etc/pacman.d/gnupg/*

vi /etc/pacman.d/mirrorlist

pacman-key --init && pacman-key --populate archlinux

pacman -S wget vim
echo " >>>>>> edit /etc/pacman.conf use the wget;"
vim /etc/pacman.conf

echo " >>>>>> add user:use groups:\n audio,lp,optical,storage,video,wheel,games,power,scanner" 
useradd -m -g users -G network,http,audio,lp,optical,storage,video,wheel,games,power,scanner -s /bin/bash erasin 

pacman -S sudo 
echo "%wheel	ALL=(ALL) ALL"
visudo

echo " >>>>>> locale.gen"
vim /etc/locale.gen
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
vim /etc/locale.conf

locale-gen

echo " >>>>>> ln zoneinfo shanghai to /etc/localtime"
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

echo " >>>>>> input your hostname to /etc/hostname"
read name
echo $name > /etc/hostname

echo " >>>>>> change root passwd"
passwd

echo " >>>>>> syslinux go!"
pacman -S syslinux
echo " >>>>>> syslinux edit /boot/syslinux/syslinux.cfg for your /dev/sdaX"
syslinux-install_update -i -a -m
vim /boot/syslinux/syslinux.cfg

echo "----------------------------------------------------------"

echo " >>>>>> devece"
pacman -S xorg-server xorg-server-utils xorg-xinit mesa lib32-mesa xf86-input-keyboard xf86-input-mouse xf86-input-wacom xf86-input-synaptics laptop-mode-tools ntfs-3g ntfsprogs dosfstools alsa-utils alsa-plugins alsa-firmware pulseaudio-alsa 
#echo " >>>>>> see lspci"
#lspci
#pacman -Ss xf86-video
echo " >>>>>> nvidia"
pacman -S nvidia nvidia-utils lib32-nvidia-libgl #opencl-nvidia

echo " >>>>>> systemd for xinit"
systemctl -f enable graphical.target

echo " >>>>>> wireless tool"
pacman -S wireless_tools wpa_supplicant wpa_actiond dialog

pacman -S networkmanager 
systemctl enable NetworkManager

#pacman -S wicd wicd-gtk
#systemctl enable wicd

pacman -S openssh sshfs
echo " >>>>>> dbus"
pacman -S dbus gamin cpufrequtils pm-utils at
systemctl enable crond 
systemctl enable atd

#echo add "dbus hal gamin atd to DAEMONS of /etc/rc.conf acpi-cpufreq cpufreq_ondemand cpufreq_powersave add MODULES"

echo " >>>>>> automake "
pacman -S automake make fakeroot afur-aur afur-makepkg

echo "fvwm"
pacman -S fvwm

echo " >>>>>> ===========>>>>>> setp 2"

echo " >>>>>>  >>>>>> nginx"
pacman -S nginx mariadb mariadb-clients php php-fpm php-gd php-pear php-memcache php-memcached vsftpd xdebug doxygen

echo " >>>>>> gvim"
pacman -S gvim vim-runtime ranger vim-a vim-align vim-bufexplorer vim-colorsamplerpack vim-doxygentoolkit vim-fugitive  vim-guicolorscheme vim-indent-object vim-omnicppcomplete vim-nerdtree vim-project vim-supertab  vim-surround vim-taglist vim-ultisnips ctags vim-pastie 

echo " >>>>>> tool"
pacman -S htop iftop ntop lftp screen lshw tree testdisk bash-completion rdesktop dmenu most xdg-user-dirs w3m ncdu gnuplot aria2
echo " >>>>>> input"
#pacman -S ibus ibus-pinyin ibus-anthy ibus-qt notification-daemon
pacman -S fcitx fcitx-cloudpinyin fcitx-configtool fcitx-googlepinyin fcitx-gtk2 fcitx-gtk3 fcitx-mozc fcitx-qt4 fcitx-qt5 fcitx-ui-light

echo " >>>>>> mplayer"
pacman -S mplayer gnome-video-effects gstreamer0.10 gstreamer0.10-bad gstreamer0.10-bad-plugins gstreamer0.10-base gstreamer0.10-base-plugins gstreamer0.10-ffmpeg gstreamer0.10-good gstreamer0.10-good-plugins gstreamer0.10-python gstreamer0.10-ugly gstreamer0.10-ugly-plugins phonon-gstreamer osdlyrics xmms2 mencoder

#pacman -S totem-plugin totem gst-liba
#pacman -S imagemagick

echo " >>>>>> font ttf"
pacman -S wqy-bitmapfont wqy-microhei wqy-zenhei ttf-ubuntu-font-family ttf-sazanami  

echo " >>>>>> git control"
pacman -S tk git subversion telepathy 
#for empathy account 

sudo pacman -S golangide

echo " >>>>>> soft"
pacman -S zim unison filezilla gparted  stardict gprename mypaint transmission-qt flashplugin pidgin pidgin-lwqq  pidgin-libnotify  notification-daemon  mcomix recordmydesktop mpd mpc gmpc

#echo " >>>>>> lib" 
#pacman -S java-runtime libpng12  p7zip unzip unrar stardict ntp
#epiphany-extensions

#echo " >>>>>> install e17"
#pacman -S enlightenment17 xterm

#pacman -S gnome gnome-extra gnome-tweak-tool

#echo ">>>>>> theme"
#pacman -S oxygen-gtk2 oxygen-gtk3 

#echo "kde"
#echo " >>>>>> gtk engine"
#pacman -S gtk-engine-unico gtk-engine-murrine gdk-pixbuf2
#echo " >>>>>> develop tool"
#pacman -S kdevelop kdevelop-php kdevelop-python 
#pacman -S kde-meta-kdebase kde-meta-kdeadmin kde-l10n-zh_cn kdesdk-dolphin-plugins apper yakuake appmenu-qt
#pacman -S qtcurve-gtk2 qtcurve-kde3 qtcurve-kde4 gtk-qt-engine
# kde kdegraphic
#pacman -S kdegraphics-okular  kdegraphics-gwenview kdegraphics-kcolorchooser kdegraphics-kruler kdeutils-ark kdegames-katomic kdegames-kmines kdegames-ksquares kdegames-ksudoku kdegraphics-ksnapshot kdemultimedia-mplayerthumbs kdemultimedia-kmix kdemultimedia-mplayerthumbs kdeplasma-addons-applets-plasmaboard kdeplasma-addons-applets-showdesktop kdeplasma-addons-runners-audioplayercontrol kdeplasma-addons-applets-icontasks qt-recordmydesktop 

# kde全版本
# pacman -S kdebase kdeadmin kdeartwork kdegraphics-gwenview kdegraphics-okular kdenetwork kdepim kdeplasma-addons kdeutils yakuake oxygen-gtk2 oxygen-gtk3 oxygen-icons kde-gtk-config

#echo " >>>>>> yaourt"
#pacman -S yaourt fakeroot automake afur-aur

#echo " >>>>>> -333----------------------"
#aur/rabbitvcs
#yaourt -S google-chrome ttf-google-webfonts-git
#yaourt -S ttf-vlgothic
#yaourt -S nautilus-filename-repairer

#pdftk 工具
#yaourt -S pdftk 
#yaourt -S gocode-git

pacman -S bashburn bashdb bashrun
